#ifndef __AUDIO_DECODER_H__
#define __AUDIO_DECODER_H__
#include "stdint.h"
#include "y_ringbuf.h"
#include "os_task.h"
#include "os_mem.h"


#define DECODER_EVENT (0)
#define DECODER_REMAIN_EVENT (1)

extern uint16_t task_id_audio_decode;

typedef enum
{
		APP_DECODER_STATE_IDLE = 0,
    APP_DECODER_STATE_BUSY = 1,
    APP_DECODER_STATE_MAX = 2
}Current_Decoder_Status_t;

typedef struct
{
	uint32_t current_frame_index;
	uint32_t current_send_frame_index;
	Current_Decoder_Status_t status;
	RINGBUF_st *src_in_ringbuffer;
	RINGBUF_st *Decoder_out_ringbuffer;

}Audio_Decode_t;	


#define DECODE_AUDIO_FRAME_LEN    64
#define DECODE_RINGBUFFER_LEN		  1024*5

void audio_decoder_init(void);

void msg_post_decode_handler();

void audio_src_write_to_ringbuffer(uint8_t *data,int len);
void audio_decode_write_to_ringbuffer(uint8_t *data,int len);

uint16_t audio_read_src_ringbuffer_len(uint8_t *read,int len);
uint16_t audio_read_decode_ringbuffer_len(uint8_t *read,int len);

bool get_audio_decoder_is_busy(void);
uint16_t get_audio_decoder_valid_size();
#endif